for (var t, e, a, s = require("../../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../../utils/dateutils.js")), i = [], h = [], o = [], n = [], d = [], u = [], r = 1970; r <= 2100; r++) i.push(r);

for (var D = 1; D <= 12; D++) h.push(D);

for (var f = 1; f <= 31; f++) o.push(f);

for (var c = 0; c < 24; c++) n.push(c);

for (var l = 0; l < 60; l++) d.push(l);

for (var m = 0; m < 60; m++) u.push(m);

Component({
    properties: {
        data: {
            type: Object,
            value: ""
        },
        date: {
            type: Number,
            value: new Date().getTime()
        },
        mode: {
            type: String,
            value: "MD",
            observer: function(t, e, a) {
                this.setDateByMode();
            }
        },
        isShowDatePicker: {
            type: Boolean,
            value: !1
        }
    },
    data: {
        cMode: "",
        years: i,
        months: h,
        days: o,
        hours: n,
        minutes: d,
        seconds: u,
        value: [],
        isShowYear: !1,
        isShowMonth: !1,
        isShowDay: !1,
        isShowHour: !1,
        isShoMinutes: !1,
        isShowSeconds: !1
    },
    lifetimes: {
        attached: function() {
            this.setDateByMode();
        },
        moved: function() {},
        detached: function() {}
    },
    attached: function() {},
    ready: function() {},
    pageLifetimes: {
        show: function() {},
        hide: function() {},
        resize: function() {}
    },
    methods: {
        setDateByMode: function() {
            var i = s.default.getYear(this.data.date), h = s.default.getMonth(this.data.date);
            this.setDays(i, h);
            var o = s.default.getDay(this.data.date), n = s.default.getHour(this.data.date), d = s.default.getMinute(this.data.date), u = s.default.getSecond(this.data.date);
            t = i, e = h, this.setData({
                value: [ i - 1970, h - 1, o - 1, n, d, u ]
            }), a = this.data.value, this.setColumns();
        },
        setColumns: function() {
            var t = this.data.mode;
            this.setData({
                isShowYear: "YMDhms" == t || "YMDhm" == t || "YMD" == t,
                isShowMonth: "YMDhms" == t || "YMDhm" == t || "YMD" == t || "MD" == t,
                isShowDay: "YMDhms" == t || "YMDhm" == t || "YMD" == t || "MD" == t,
                isShowHour: "YMDhms" == t || "YMDhm" == t || "hm" == t,
                isShoMinutes: "YMDhms" == t || "YMDhm" == t || "hm" == t,
                isShowSeconds: "YMDhms" == t
            });
        },
        setDays: function(a, i) {
            if (a != t || e != i) {
                t = a, e = i;
                for (var h = s.default.getDaysOfMonth(a, i), o = [], n = 1; n <= h; n++) o.push(n);
                this.setData({
                    days: o
                });
            }
        },
        bindChange: function(t) {
            var e = t.detail.value;
            a = e;
            var s = this.data.years[e[0]], i = this.data.months[e[1]];
            this.setDays(s, i);
        },
        onCancellClick: function() {
            this.triggerEvent("datePickerCancellEvent");
        },
        onOkClick: function() {
            var t = {};
            t.data = this.data.data, t.date = this.getResultDate(), this.triggerEvent("datePickerOkEvent", t);
        },
        getResultDate: function() {
            var t = this.data.years[a[0]], e = this.data.months[a[1]] - 1, s = this.data.days[a[2]], i = this.data.hours[a[3]], h = this.data.minutes[a[4]], o = this.data.seconds[a[5]];
            return new Date(t, e, s, i, h, o).getTime();
        }
    }
});